package queue;

public class QueueOfLinked<Item> {

    private Node head;

    private Node tail;

    private int size;

    class Node{
        Item item;
        Node next;

        public Node(Item item){
            this.item = item;
        }
    }

    public void enQueue(Item item){
        Node node = new Node(item);
        if(tail == null){
            head = node;
            tail = node;
        }
        tail.next = node;
        size ++;
    }

    public void deQueue(){
        if(head == null){
            return;
        }
        if(size == 1){
            tail = null;
        }
        Node node = head.next;
        head = node;
    }
}
